<%--
  Created by IntelliJ IDEA.
  User: fyf
  Date: 2018/11/8
  Time: 17:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/common/taglib.jsp" %>
<%

    session.getAttribute("branchid");

%>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta charset="utf-8"/>
  <title>课程信息管理</title>
  <meta name="description" content="overview &amp; stats"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
  <jsp:include page="/common/basecss.jsp" flush="true"/>
  <script src="${pageContext.request.contextPath}/js/jquery-2.1.0.js"></script>
  <script src="${pageContext.request.contextPath}/assets/js/layer-v3.1.0/layer/layer.js"></script>
</head>
<body>

<div class="main-container" id="main-container">
  <div class="main-content" id="page-wrapper">
    <div class="page-content" id="page-content">
      <div class="row">
        <div class="col-xs-12">
          <div class="text-right">
            <button type="button" class="btn btn-white btn-inverse btn-lg"
                    onclick="addCourse()">添加课程</button>

          </div>

          <table class="table table-striped table-bordered table-hover center">
            <tr>
              <th colspan="7" class="center">
                <h2>课程信息查询</h2>
              </th>
            </tr>
            <span>
            <tr>
              <td ><h4>课程编号</h4></td>
              <td ><h4>课程名称</h4></td>
              <td ><h4>操作</h4></td>
              <td ><h4>操作</h4></td>

            </tr></span>

            <c:forEach items="${courseList}" var="course">
              <tr>
                <td>${course.id}</td>
                <td>${course.coursename}</td>
                <td hidden>${branchid}</td>
                <td>
                  <button type="button" class="btn btn-white btn-inverse btn-sm"
                          onclick="delCourse('${course.id}','${course.coursename}');">删除</button>
                </td>
                <td>
                  <button type="button" class="btn btn-white btn-inverse btn-sm"
                          onclick="updateCourse('${course.id}');">修改</button>
                </td>
              </tr>
            </c:forEach>

          </table>
        </div>
      </div>
    </div>
  </div>
</div>


<%--删除--%>
<script>
    function delCourse(kid,coursename) {
        layer.confirm(
            "确认要删除课程《"+coursename+"》吗？",
            {
                btn:['是的','不，点错了']
            },
            function(){
                window.location.href="deleteCourseByKid.go?kid="+kid;
            }
            ,
            function(){
                layer.msg("好的",{icon: 6});
            }

        )
    }

</script>

<%--修改--%>
<script>
    function updateCourse(kid) {
        layer.open({
            title: '修改课程信息',
            type: 2,
            area: [
                '600px',
                '430px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose:true,

            content:'forwardUpdateCourse.go?kid='+kid
        });
    }

</script>

<%--添加--%>
<script>
    function addCourse() {
        layer.open({
            title: '添加课程',
            type: 2,
            area: [
                '600px',
                '430px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose:true,

            content:'forwardAddCourse.go'
        });
    }

</script>


<jsp:include page="/common/basejs.jsp" flush="true"/>
</body>
</html>
